package com.moss.system.service.impl;

import com.moss.common.entity.SysTaskCompanyEntity;
import com.moss.common.entity.SysTaskEntity;
import com.moss.common.entity.SysTaskGoodsEntity;
import com.moss.system.mapper.TaskCompanyMapper;
import com.moss.system.mapper.TaskGoodsMapper;
import com.moss.system.mapper.TaskMapper;
import com.moss.system.service.TaskService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TaskServiceImpl implements TaskService {

    @Resource
    TaskMapper taskMapper;

    @Resource
    TaskGoodsMapper taskGoodsMapper;

    @Resource
    TaskCompanyMapper taskCompanyMapper;


    @Override
    public List<SysTaskEntity> getTaskList(SysTaskEntity task) {
        return taskMapper.selectList(task);
    }


    @Override
    public SysTaskEntity getTask(String taskId) {
        SysTaskEntity task = taskMapper.selectById(taskId);
        List<SysTaskGoodsEntity> goods = taskGoodsMapper.selectById(taskId);
        task.setGoodsList(goods);
        List<SysTaskCompanyEntity> companyList = taskCompanyMapper.selectById(taskId);
        task.setCompanyList(companyList);
        return task;
    }
}
